package com.jike.buyi.system.index.service.impl;


import com.jike.buyi.system.index.domain.UserVo;
import com.jike.buyi.system.index.dao.IndexDao;
import com.jike.buyi.system.index.service.IndexService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class IndexServiceImpl implements IndexService {

    @Autowired
    private IndexDao indexDao;

    @Override
    public String checkUser(String username, String password) {
        String r ="1";
        UserVo userVo = indexDao.checkUser(username,password);
        if(userVo==null){
            r="0";
        }else if(userVo.getIsvalid()!=null && userVo.getIsvalid()!=1){
            r="2";
        }else {
            r = "1";
        }
        return r;
    }

    @Override
    public UserVo getUser(String username, String password) {
        return indexDao.checkUser(username,password);
    }
}
